/***********************************************************************
 * Module:  Scene.java
 * Author:  luohaoyang
 * Purpose: Defines the Class 场景
 ***********************************************************************/

package com.afteryuan.engine.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Proxy;
import com.afteryuan.dao.BaseObject;

@Entity
@Table(name = "T_Scene")
@Proxy(lazy = false)
public class Scene extends BaseObject {

	public static final Integer DIRECT_NORTH= 0;
	public static final Integer DIRECT_EAST= 1;
	public static final Integer DIRECT_SOUTH= 2;
	public static final Integer DIRECT_WEST= 3;

    /**
     * 启用
     */
    public static final Integer SCENE_STATUS_USE = 1;
    /**
     * 未用
     */
    public static final Integer SCENE_STATUS_NOTUSE = 0;

    /** 场景ID */
    private java.lang.String id;
	/** 场景名称 */
	private java.lang.String name;
	/**偏移量Y*/
	private Integer offsetY;
	/** charx */
	private Integer charx;	
	/** chary */
	private Integer chary;
	/** 状态 */
	private Integer status;	
	/** 类型 */
	private Integer type;
    /** 创建时间 */
    private java.lang.Long createTime;
    /** 更新时间 */
    private java.lang.Long updateTime;
    /** 背景图 */
    private Image background;    
    /** 缩略图 */
    private Image miniMap;    
    /** 图标 */
    private Image iconMap;
    /**卡片刷新最大数量*/
    private Integer functionMax;
    /**卡片刷新最小数量*/
    private Integer functionMin;


    public Integer getFunctionMax() {
        return functionMax;
    }

    public void setFunctionMax(Integer functionMax) {
        this.functionMax = functionMax;
    }

    public Integer getFunctionMin() {
        return functionMin;
    }

    public void setFunctionMin(Integer functionMin) {
        this.functionMin = functionMin;
    }

    public Scene() {
		setCreateTime(new Date().getTime());
	}

	public Scene(String id) {
        this.id=id;
        setCreateTime(new Date().getTime());
	}

	@Id
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "uuid")
	public java.lang.String getId() {
		return id;
	}

	public void setId(java.lang.String id) {
        if(id.equals(""))id=null;
        this.id = id;
	}

	public java.lang.String getName() {
		return name;
	}

	public void setName(java.lang.String name) {
		this.name = name;
	}

	public Integer getCharx() {
		return charx;
	}

	public void setCharx(Integer charx) {
		this.charx = charx;
	}

	public Integer getChary() {
		return chary;
	}

	public void setChary(Integer chary) {
		this.chary = chary;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	@Column(updatable = false)
	public Long getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Long createtime) {
		this.createTime = createtime;
	}



    @ManyToOne
    @JoinColumn(name="BACKGROUND_ID")
    public Image getBackground() {
        return background;
    }

    public void setBackground(Image background) {
        this.background = background;
    }

    @ManyToOne
    @JoinColumn(name="MINIMAP_ID")
	public Image getMiniMap() {
		return miniMap;
	}

	public void setMiniMap(Image miniMap) {
		this.miniMap = miniMap;
	}

    @ManyToOne
    @JoinColumn(name="ICONMAP_ID")
	public Image getIconMap() {
		return iconMap;
	}

	public void setIconMap(Image iconMap) {
		this.iconMap = iconMap;
	}

	public java.lang.Long getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(java.lang.Long updateTime) {
		this.updateTime = updateTime;
	}

    public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		Scene scene = (Scene) o;

		if (!id.equals(scene.id))
			return false;

		return true;
	}

	public int hashCode() {
		return id.hashCode();
	}

    @Override
    public String toString() {
        return "As3Scene{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", charx=" + charx +
                ", chary=" + chary +
                ", status=" + status +
                ", type=" + type +
                ", createtime=" + createTime +
                ", updateTime=" + updateTime +
                ", background=" + background +
                '}';
    }

	public Integer getOffsetY() {
		return offsetY;
	}

	public void setOffsetY(Integer offsetY) {
		this.offsetY = offsetY;
	}
}